﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
 工作维护时间
</title><link href="<%=basePath %>Styles/css.css" rel="stylesheet" type="text/css" />
    <script src="<%=basePath %>Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="<%=basePath %>Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="<%=basePath %>Scripts/IndexManager.js" type="text/javascript"></script>
    <script src="<%=basePath %>Scripts/selectProject.js" type="text/javascript"></script>
    <script type="text/javascript">
        function openWin() {

            showModalDialog("WorkingTimeUpdateManager.htm", "example04", "dialogWidth:600px;dialogHeight:300px;dialogLeft:200px;dialogTop:150px;center: yes;help:yes;resizable:yes;status:yes")
        }

    </script>
</head>

<body style="margin-top: 5px; background: #EFF3FF;">
    <form method="post" action="WorkingTimeManager.htm" id="form1">

    <div id="divOne">
        <div>
            <table width="100%">
                <tr id="ProjectsType">
					<%-- <td width="7%">
                        	项目名称：
                    </td>
					<td width="15%">
                        <input name="projectname" type="text" id="projectname"  style="width:95%;" />
                    </td>
					<td width="10%">
                        <input style="border-style: none; border-color: inherit; border-width: 0px; background-image: url('<%=basePath %>images/search.gif'); width: 100px; height: 24px;" 
                            type="button" id="selectpn" name="selectpn"/>
                    </td> --%>
					<td width="10%">
                        <!-- <input type="button" id="btnAdd" class="button" value="添加"  /> -->
                        <a href="add.do" id="add">添加</a>
                    </td>
                    <td width="10%">
                       <!--  <input type="button" id="btnAdd" class="button" value="删除"  /> -->
                    	<a id="delete">删除</a>
                    </td>
                    <td width="10%">
                        <!-- <input type="button" id="btnAdd" class="button" value="修改"  /> -->
                    	<a id="update">修改</a>
                    </td>
                    <td >
                        <!-- <input type="button" id="btnAdd" class="button" value="修改"  /> -->
                    	<a id="">生成房间</a>
                    </td>
				</tr>
 
            </table>
        </div>
        <div class="cxlb_2" id="indexs">
            <table width="100%" class="tablist" id="table1">
                <thead>
                    <tr>
                        <th width="3%">
                            <input name="select_all" id="select_all" type="checkbox" />
                        </th>
                        <th width="5%">
                            序号
                        </th>
                        <th width="12%">
                            楼栋名称
                        </th>
                        <th width="13%">
                            楼栋楼层数
                        </th>
                        <th width="13%">
                            每个楼层房间数
                        </th>
                        <th width="13%">
                            所属项目
                        </th>
                        <th width="12%">
                            修改人
                        </th>
                        <th width="12%">
                            修改时间
                        </th>
                        <th width="">
                            备注
                        </th>
                    </tr>
                </thead>
                <tbody id="tab">
                <c:forEach var="bbean" items="${list}" step="1">
                	<tr>
                        <td width="3%">
                            <input type="checkbox" name="select_item"  id="select_item"  value="${bbean.buildId}">
                        </td>
                        <td width="5%">
                        
                        </td>
                        <td width="12%">
							${bbean.buildName}
                        </td>
                        <td width="13%">
	                        ${bbean.floorCount}
                        </td>
                        <td width="13%">
	                        ${bbean.roomCount}
                        </td>
                        <td width="13%">
                        	${bbean.pbean.projectName}
                        </td>
                        <td width="12%">
                            ${bbean.updateUser}
                        </td>
                        <td width="12%">
                        	<c:if test="${!empty bbean.updateTime}">
                        		<fmt:formatDate value='${bbean.updateTime}' type='date' pattern='yyyy-MM-dd'/>
                        	</c:if>
                        </td>
                        <td width="">
                            ${bbean.remark}
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <script type="text/javascript">
<!--
                var Ptr = document.getElementById("tab").getElementsByTagName("tr");
                function pageLoad() {
                    for (i = 1; i < Ptr.length + 1; i++) {
                        Ptr[i - 1].className = (i % 2 > 0) ? "t1" : "t2";
                    }
                }
                window.onload = pageLoad;
                for (var i = 0; i < Ptr.length; i++) {
                    Ptr[i].onmouseover = function () {
                        this.tmpClass = this.className;
                        this.className = "t3";

                    };
                    Ptr[i].onmouseout = function () {
                        this.className = this.tmpClass;
                    };
                }
//-->
//序号
window.onload=function(){
	var oTable = document.getElementById("tab");
	for(var i=0;i<oTable.rows.length;i++){
		oTable.rows[i].cells[1].innerHTML=(i+1);
	}
}
//条件查询
$(function(){
	$("#selectpn").click(function(){
		var a = $("#projectname").val();
		window.location.href="selectall.do?projectname="+a;
	});
});
//删除
var arr = new Array();
$(function(){  
    $("#delete").click(function() {
    	var a = confirm("确认删除？");
    	if(a){
    		 $("input[name='select_item']:checked").each(function() { // 遍历选中的checkbox
    	            n = $(this).parents("tr").index();  // 获取checkbox所在行的顺序
    	            alert(n);
    	            window.alert($(this).val());
    	            arr.push($(this).val());
    	      });
    		 window.location.href="deletebyprimarykey.do?buildIdArray="+arr;
    	}
    });
});
//修改
$(function(){  
    $("#update").click(function() { 
    		 var a=$(':checked').length;
    		 alert(a);
    		 var buildId=$("input[name='select_item']:checked").val();
    		 alert(buildId);
    		 if(a==1){
	            	window.location.href="selectone.do?buildId="+buildId;	
	            }else{
	            	window.alert("您选中的行数大于1或小于，请选择一行进行修改");
	            }
    });
});
//全选，全不选
var checkboxes = document.getElementsByName('select_item');
              $("#select_all").click(function() {
                  for (var i = 0; i < checkboxes.length; i++) {
                      var checkbox = checkboxes[i];
                      if (!$(this).get(0).checked) {
                          checkbox.checked = false;
                      } else {
                          checkbox.checked = true;
                      }
                  }
              });
       //单个选中
            $('#tb1 tbody').on('click', "input", function() {
            var rowObj=dataExample.row($(this).closest("tr"));
            	alert("1111");
                var checkbox = document.getElementById(rowObj.data().tbid);
                if(checkbox.checked==true){
                    checkbox.checked=false
                }else{
                    checkbox.checked=true 
                }
            });
            </script>
        </div>
        <div id="pageType">
            
<!-- AspNetPager 7.3.2  Copyright:2003-2010 Webdiyer (www.webdiyer.com) -->
<div id="AspNetPager1" class="anpager" style="width:100%;text-align:left;">
<div align="left" class="anpager" style="width:60%;float:left;">
	<a disabled="disabled" style="margin-right:10px;">首页</a><a disabled="disabled" style="margin-right:10px;">上一页</a><span class="cpb" style="margin-right:10px;">1</span><a disabled="disabled" style="margin-right:10px;">下一页</a><a disabled="disabled" style="margin-right:10px;">尾页</a>
</div><div class="anpager" style="width:40%;float:left;">
	记录总数：<font color="blue"><b>8</b></font> 总页数：<font color="blue"><b>1</b></font> 当前页：<font color="red"><b>1</b></font>
</div>
</div>
<!-- AspNetPager 7.3.2  Copyright:2003-2010 Webdiyer (www.webdiyer.com) -->
 
 
        </div>
    </div>
    <input type="hidden" name="hidProductIdSelect" id="hidProductIdSelect" />
    </form>
</body>
</html>
